package com.learning.algorithm.util;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;

/**
 * @author: daqian_liao
 * @Date: 2018/12/13 19:27
 * @Version 1.0
 */
public class IKAnalyseUtil {
    public static void split(String text) {
        StringReader reader = new StringReader(text);
        try {
            IKSegmenter ik = new IKSegmenter(reader, true);
            Lexeme lex = null;

            while ((lex = ik.next()) != null) {
                System.out.print(lex.getLexemeText() + "|");
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        split("张三应督促深圳桃夭劳务公司马上整改");
    }
}
